<?php
		include_once("global.php");
		//-----------------------------------------//	
	
		$upfile_date_2	=	substr(mt_rand(),0,4);
		$userfile_name_2	=	$upfile_date_2."_".$file_name_2;
		$upfile_2 		= 	_upload_path.$userfile_name_2;
		move_uploaded_file($userfile_2,$upfile_2);
		//-----------------------------------------//
		
		$type_register = $_POST['type'];   
		// // echo $type_register;
        if ($type_register=="register.php"){
            $type_register=0; // 0: ca nhan
           	$email = $_POST['email'];
    		$password = $_POST['password'];
    		$confirmpass = $_POST['confirmpass'];
    		
    		$firstname = $_POST['firstname'];
    		$lastname = $_POST['lastname'];
    		$sex = $_POST['sex'];
    		$day = $_POST['day'];
    		$month = $_POST['month'];
    		$year = $_POST['year'];
    		$cmnd = $_POST['cmnd'];
    		$phone = $_POST['phone'];
    		$address = $_POST['address'];
    		$country = $_POST['country'];
    		if(isset($email)){
				
    			$sql = "insert into vt_register(type_register,email,password,firstname,lastname,sex,day,month,year,
                cmnd,phone,address,country) values('".$type_register."','".$email."','".md5($password)."',
                '".$firstname."','".$lastname."','".$sex."','".$day."','".$month."','".$year."','".$cmnd."','".$phone."',
                '".$address."','".$country."')";
				// echo $sql;
    			$rs = mysql_query($sql);
	      }
		  ?> 
			<script>
				alert('Ban da dang ky thanh cong ');
				window.location.href="./";
				parent.$.fn.colorbox.close();
			</script>
		  <?php
			exit();
        }
        if ($type_register=="register_doanhnghiep.php"){
            $type_register = 1; //1 doanh nghiep
            $email = $_POST['email'];
    		$password = $_POST['password'];
    		
            $tencongty = $_POST['tencongty'];
            $address = $_POST['diachi'];
            $country = $_POST['country'];
            $masothue = $_POST['masothue'];
            
            $firstname = $_POST['firstname'];
    		$lastname = $_POST['lastname'];
            $sex = $_POST['sex'];
            $day = $_POST['day'];
    		$month = $_POST['month'];
    		$year = $_POST['year'];
            $phone = $_POST['phone'];
            if(isset($email)){
    			$sql = "insert into vt_register(type_register,email,password,firstname,lastname,sex,day,month,
                year,phone,address,country,tencongty,masothue) values('".$type_register."','".$email."','".md5($password)."',
                '".$firstname."','".$lastname."','".$sex."','".$day."','".$month."','".$year."',
                '".$phone."','".$address."','".$country."','".$tencongty."','".$masothue."' )";
    			$rs = mysql_query($sql);
			}
			?>
			<script>
				alert('Ban da dang ky thanh cong ');
				window.location.href="./";
				parent.$.fn.colorbox.close();
			</script>
			
			<?php
    }
	
?>


